<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <style th:inline="css">
        .bobo{
            color: red;
        }
    </style>
</head>
<body>

    this is bobo page ,and you?<br>

    <!--获取单个值-->
    <span th:text="username"></span>
    <span>xxxxxx</span><br>

    <!--获取对象值-->
    用户名：<span th:text="${user.name}">xxxx</span><br>
    密码：<span th:text="${user.password}"></span><br>

    <!--运算年龄*2-->
    <span th:text="'年龄的2倍是'+${user.age}*2"></span><br>

    <!--逻辑运算符-->
    <span th:text="(${user.age} eq 20)"></span><br>

    <!--条件运算-->
    <span th:if="(${user.age} eq 18)">条件成立我显示</span><br>
    <span th:unless="(${user.age} eq 20)"></span>条件不成立我显示<br>

    <!--switch分支-->
    <div th:switch="${username}">
        <p th:case="铁蛋">我是铁蛋</p>
        <p th:case="二狗">我是二狗</p>
        <p th:case="*">我是都没匹配才匹配上我</p>
    </div>

    <!--switch分支-->
    <div th:switch="${username}">
        <span th:case="铁蛋">我是铁蛋</span>
        <span th:case="二狗">我是二狗</span>
        <span th:case="*">我是都没匹配才匹配上我</span>
    </div>

    <!--for-->
    <table>
        <tr>
            <th>用户id</th>
            <th>名字</th>
            <th>密码</th>
            <th>年龄</th>
            <th>索引</th>
        </tr>
        <tr th:each="user,state: ${users}">
            <td th:text="${user.id}"></td>
            <td th:text="${user.name}"></td>
            <td th:text="${user.password}"></td>
            <td th:text="${user.age}"></td>
            <td th:text="${state.index}"></td>
        </tr>
    </table>

    <!--object $和*共用-->
    <div th:object="${user}">
        <p th:text="*{password}"></p>
        <p> *{username}</p>
    </div>

    <!--inline css-->
    <span class="bobo">china</span>

    <!--inline 普通-->
    <span th:inline="text">[[${username}]]</span>

    <!--inline javascript-->
    <script th:inline="javascript">
        var name=[[${username}]];
        alert(name)
    </script>
</body>
</html>